<template>
  <div class="callCenterInfos">
    <TitleName
      class="title mb-20px"
      icon="i-carbon-bookmark-filled"
      title="来电记录"
    ></TitleName>
    <el-table :data="tableList" border>
      <el-table-column label="来电时间" prop="telDate" width="220">
      </el-table-column>
      <!--      <el-table-column label="来电人" prop="telPerson" width="110" />-->
      <el-table-column label="来电电话" prop="personTel" width="150" />
      <el-table-column label="是否已派单" prop="dispatchMark" width="130" />
      <el-table-column label="受理人" prop="userName" width="110" />
      <el-table-column
        :show-overflow-tooltip="true"
        label="问题分类"
        prop="questionTypeName"
        width="180"
      />
      <el-table-column label="问题描述" prop="questionContent" questionAnswer />
      <el-table-column label="问题答案" prop="questionAnswer" />
    </el-table>
    <pagination
      v-show="total > 0"
      v-model:limit="searchFrom.pageSize"
      v-model:page="searchFrom.pageNum"
      :total="total"
      @pagination="getList"
    />
  </div>
</template>

<script name="PRScallHistory" setup>
import { getCurrentInstance } from 'vue'
import { getListByCustomer } from '@/api/customerManage/customerList'
const { proxy } = getCurrentInstance()
import useUserStore from '@/store/modules/user'
import useCommonStore from '@/store/modules/common'
import { recordList } from '@/api/callCenter'
const userStore = useUserStore()
const commonStore = useCommonStore()

// 接受父级传递的参数
const props = defineProps({
  paramData: {
    required: true,
    type: Object || Array,
    default: () => {
      return {}
    }
  }
})
const data = reactive({
  searchFrom: {
    pageSize: 10,
    pageNum: 1
  },
  total: 0,
  tableList: []
})
const { searchFrom, total, tableList } = toRefs(data)
function getList() {
  recordList({
    customerTaxcode: props.paramData.customerTaxcode,
    orgId: props.paramData.orgId,
    pageNum: searchFrom.value.pageNum,
    pageSize: searchFrom.value.pageSize
  }).then(res => {
    tableList.value = res.rows
    total.value = res.total
    console.log(total.value, res.total, 'res---')
  })
}

watch(
  () => props.paramData,
  val => {
    if (JSON.stringify(val) != '{}') {
      console.log('来电记录接收参数：', val)
      getList()
    }
  },
  {
    immediate: true,
    deep: true
  }
)
</script>

<style lang="scss" scoped></style>
